﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;

namespace ThiefRun.Util.Keyboards
{
    public class KeyboardManager
    {
        #region Constants
        // Constants
        #endregion Constants

        #region Properties
        // Properties
        private List<KeyboardAction> keyboardActions;
        #endregion Properties

        #region Computed Properties
        // Computed Properties
        #endregion Computed Properties

        #region Methods
        // Methods

        #region Constructors
        /// <summary>
        /// Initialize the KeyboardManager.
        /// </summary>
        public KeyboardManager()
        {
            this.keyboardActions = new List<KeyboardAction>();
        }
        #endregion Constructors

        /// <summary>
        /// Add a key-action pair.
        /// </summary>
        /// <param name="keys">The keys to be pressed.</param>
        /// <param name="action">The action to execute.</param>
        public void Add(List<Keys> keys, KeyboardAction.Action action)
        {
            keyboardActions.Add(new KeyboardAction(keys, action));
        }

        /// <summary>
        /// Process all the key-action pairs.
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime)
        {
            keyboardActions.ForEach(ka => ka.Update(gameTime));
        }

        #endregion Methods
    }
}
